package es.cazadoresmadridejos.model;

import java.math.BigDecimal;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;

import es.cazadoresmadridejos.util.constants.Constants;

@Entity(name="Deer")
@Table(name="rececho_corzo")
public class Deer extends BaseEntity{

	private Reason reason;
	private Partner partner;
	private BigDecimal payment;
	private Date date;
	private BigDecimal prePayment;
	private Integer hunt;
	
	@ManyToOne(optional=false)
	@JoinColumn(name="temporada")			
	public Reason getReason() {
		return reason;
	}
	public void setReason(Reason reason) {
		this.reason = reason;
	}
	@ManyToOne(optional=false)
	@JoinColumn(name="usuario")		
	public Partner getPartner() {
		return partner;
	}
	public void setPartner(Partner partner) {
		this.partner = partner;
	}
	@Column(name="postpago")
	public BigDecimal getPayment() {
		return payment;
	}
	public void setPayment(BigDecimal payment) {
		this.payment = payment;
	}
	@Transient
	public String getDateString() {
		if(date == null){
			return "";
		}
		return Constants.sdf.format(date);
	}
	@Column(name="fecha")
	public Date getDate() {
		return date;
	}
	public void setDate(Date date) {
		this.date = date;
	}
	@Column(name="prepago")
	public BigDecimal getPrePayment() {
		return prePayment;
	}
	public void setPrePayment(BigDecimal prePayment) {
		this.prePayment = prePayment;
	}
	@Column(name="abatido")
	public Integer getHunt() {
		return hunt;
	}
	public void setHunt(Integer hunt) {
		this.hunt = hunt;
	}
	
	
}
